home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / Macintosh Tracker 1.20 / source / Tracker Client Folder / Core 18⁄March⁄1994 / CViewRect.c < prev    next >
Encoding:
Text File  |  1993-06-27  |  9.1 KB  |  164 lines  |  [TEXT/KAHL]

  1. dow != this) && (Window != NIL)) /* filter the two bad possibilities */
  2.             {
  3.                 /* i.e. don't do this if we are the window. */
  4.                 SetUpPort();
  5.                 Window->InvalidateLong(ZeroPoint,Extent);
  6.                 Window->DeregisterClient(this);
  7.             }
  8.     }
  9.  
  10.  
  11. /* */        CViewRect::CViewRect()
  12.     {
  13.         EXECUTE(Initialized = False;)
  14.         MyCursor = arrow;
  15.         SetStickiness(LeftEdgeStatic,TopEdgeStatic,WidthStatic,HeightStatic);
  16.         Enabled = True;
  17.         Suspended = True;
  18.     }
  19.  
  20.  
  21. void        CViewRect::IViewRect(LongPoint TheOrigin, LongPoint TheExtent,
  22.                     CWindow* TheWindow, CEnclosure* TheEnclosure)
  23.     {
  24.         ERROR(Initialized == True,PRERR(ForceAbort,
  25.             "CViewRect::IViewRect called on already initialized object."));
  26.         EXECUTE(Initialized = True);
  27.         Start = TheOrigin;
  28.         Extent = TheExtent;
  29.         Window = TheWindow;
  30.         ERROR(TheWindow==NIL,PRERR(ForceAbort,
  31.             "CViewRect::IViewRect passed NIL for a window."));
  32.         Enclosure = TheEnclosure;
  33.         if (TheEnclosure != NIL)
  34.             {
  35.                 /* this means it is NOT a window (only windows don't have enclosures) */
  36.                 TheEnclosure->RegisterViewRect(this);
  37.                 RecalcLocsInitial();
  38.                 TheWindow->RegisterClient(this);
  39.             }
  40.     }
  41.  
  42.  
  43. void            CViewRect::DoMouseDown(MyEventRec Event)
  44.     {
  45.         ERROR(Initialized != True,PRERR(ForceAbort,
  46.             "CViewRect::DoMouseDown called on uninitialized object."));
  47.     }
  48.  
  49.  
  50. void            CViewRect::DoMouseUp(MyEventRec Event)
  51.     {
  52.         ERROR(Initialized != True,PRERR(ForceAbort,
  53.             "CViewRect::DoMouseUp called on uninitialized object."));
  54.     }
  55.  
  56.  
  57. MyBoolean    CViewRect::DoKeyDown(MyEventRec Event)
  58.     {
  59.         ERROR(Initialized != True,PRERR(ForceAbort,
  60.             "CViewRect::DoKeyDown called on uninitialized object."));
  61.         return False;
  62.     }
  63.  
  64.  
  65. void            CViewRect::DoKeyUp(MyEventRec Event)
  66.     {
  67.         ERROR(Initialized != True,PRERR(ForceAbort,
  68.             "CViewRect::DoKeyUp called on uninitialized object."));
  69.     }
  70.  
  71.  
  72. MyBoolean    CViewRect::DoMouseMoved(MyEventRec Event)
  73.     {
  74.         SetCursor(&MyCursor);
  75.         return True;
  76.     }
  77.  
  78.  
  79. void            CViewRect::DoUpdate(void)
  80.     {
  81.         ERROR(Initialized != True,PRERR(ForceAbort,
  82.             "CViewRect::DoUpdate called on uninitialized object."));
  83.     }
  84.  
  85.  
  86. /* this is when the window ceases to be active */
  87. void            CViewRect::DoSuspend(void)
  88.     {
  89.         ERROR(Initialized != True,PRERR(ForceAbort,
  90.             "CViewRect::DoSuspend called on uninitialized object."));
  91.         ERROR(Suspended,PRERR(ForceAbort,
  92.             "CViewRect::DoSuspend called on a suspended object."));
  93.         if ((KeyReceiverViewRect != this) || ((KeyReceiverViewRect == this)
  94.             && (RelinquishKeyReceivership())))
  95.             {
  96.                 Suspended = True;
  97.             }
  98.     }
  99.  
  100.  
  101. /* this is when the window again becomes active */
  102. void            CViewRect::DoResume(void)
  103.     {
  104.         ERROR(Initialized != True,PRERR(ForceAbort,
  105.             "CViewRect::DoResume called on uninitialized object."));
  106.         ERROR(!Suspended,PRERR(ForceAbort,
  107.             "CViewRect::DoResume called on an object that isn't suspended."));
  108.         Suspended = False;
  109.     }
  110.  
  111.  
  112. /* this is when the object becomes disabled */
  113. void            CViewRect::DoDisable(void)
  114.     {
  115.         ERROR(Initialized != True,PRERR(ForceAbort,
  116.             "CViewRect::DoDisable called on uninitialized object."));
  117.         if ((KeyReceiverViewRect != this) || ((KeyReceiverViewRect == this)
  118.             && (RelinquishKeyReceivership())))
  119.             {
  120.                 Enabled = False;
  121.             }
  122.     }
  123.  
  124.  
  125. /* this is when the object becomes enabled */
  126. void            CViewRect::DoEnable(void)
  127.     {
  128.         ERROR(Initialized != True,PRERR(ForceAbort,
  129.             "CViewRect::DoEnable called on uninitialized object."));
  130.         Enabled = True;
  131.     }
  132.  
  133.  
  134. MyBoolean    CViewRect::BecomeKeyReceiver(void)
  135.     {
  136.         ERROR(Initialized != True,PRERR(ForceAbort,
  137.             "CViewRect::BecomeKeyReceiver called on uninitialized object."));
  138.         if (ActiveWindow != Window)
  139.             {
  140.                 EXECUTE(PRERR(AllowResume,"CViewRect::BecomeKeyReceiver called when object's "
  141.                     "window was not the active window."));
  142.                 return False;
  143.             }
  144.          else
  145.             {
  146.                 if (KeyReceiverViewRect != this)
  147.                     {
  148.                         if ((KeyReceiverViewRect == NIL) || ((KeyReceiverViewRect != NIL)
  149.                             && (KeyReceiverViewRect->RelinquishKeyReceivership())))
  150.                             {
  151.                                 KeyReceiverViewRect = this;
  152.                                 return True;
  153.                             }
  154.                          else
  155.                             {
  156.                                 return False;
  157.                             }
  158.                     }
  159.                  else
  160.                     {
  161.                         return False; /* if we already are, we can't become */
  162.                     }
  163.             }
  164.     }